var mapIds = [993000000];
var 准备地图 = 993000600;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("活动_悬赏狩猎");
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully();
        d.killAllMonsters(false)
    }
    return c
}

function onPlayerRegistered(b, a) {
    a.setReviveCount(-100);
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0));
    b.startEventTimer(3 * 60 * 1000)
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
    em.setProperty("kill", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", a)
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onMonsterDamaged(b, a, d, e, c) {}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(b, c) {
    var a = em.getNumberProperty("kill") + 1;
    em.setProperty("kill", a);
    if (a == 21) {
        player.getAPI().fieldEffect_ScreenMsg("defense/count");
        var d = 21 * Math.pow(player.getAPI().getLevel(), 2) * Math.pow(2, 1);
        player.getAPI().gainExp(d);
        player.getAPI().effect_GainExpGold(d);
        b.schedule("mob2", 3 * 1000)
    } else {
        if (a == 42) {
            player.getAPI().fieldEffect_ScreenMsg("defense/count");
            var d = 42 * Math.pow(player.getAPI().getLevel(), 2) * Math.pow(2, 1.1);
            player.getAPI().gainExp(d);
            player.getAPI().effect_GainExpGold(d);
            b.schedule("mob3", 3 * 1000)
        } else {
            if (a == 63) {
                player.getAPI().fieldEffect_ScreenMsg("defense/count");
                var d = 63 * Math.pow(player.getAPI().getLevel(), 2) * Math.pow(2, 1.2);
                player.getAPI().gainExp(d);
                player.getAPI().effect_GainExpGold(d);
                b.schedule("mob4", 3 * 1000)
            } else {
                if (a == 84) {
                    player.getAPI().fieldEffect_ScreenMsg("defense/count");
                    var d = 84 * Math.pow(player.getAPI().getLevel(), 2) * Math.pow(2, 1.3);
                    player.getAPI().gainExp(d);
                    player.getAPI().effect_GainExpGold(d);
                    b.schedule("mob5", 3 * 1000)
                } else {
                    if (a == 105) {
                        player.getAPI().fieldEffect_ScreenMsg("killing/clear");
                        var d = 105 * Math.pow(player.getAPI().getLevel(), 2) * Math.pow(2, 1.4);
                        player.getAPI().gainExp(d);
                        player.getAPI().effect_GainExpGold(d);
                        player.scheduleWarpTask(3, 993000600, 0, false);
                        player.getAPI().setQuestCustomData(9930001, 6)
                    }
                }
            }
        }
    }
    return 1
}

function mob1(a) {
    a.getPlayers().forEach(function (b) {
        b.getAPI().uiChangeStage(1);
        b.getAPI().setQuestCustomData(9930001, 1);
        b.getAPI().fieldEffect_ScreenMsg("killing/stage/1");
        b.getAPI().fieldEffect_ScreenMsg("killing/first/start");
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830000, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830001, 1, -634, 153, 100)
    })
}

function mob2(a) {
    a.getPlayers().forEach(function (b) {
        b.getAPI().uiChangeStage(2);
        b.getAPI().setQuestCustomData(9930001, 2);
        b.getAPI().fieldEffect_ScreenMsg("killing/stage/2");
        b.getAPI().fieldEffect_ScreenMsg("killing/first/start");
        b.getAPI().spawnMobLimit(9830002, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830002, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830003, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830004, 1, -634, 153, 100)
    })
}

function mob3(a) {
    a.getPlayers().forEach(function (b) {
        b.getAPI().uiChangeStage(3);
        b.getAPI().setQuestCustomData(9930001, 3);
        b.getAPI().fieldEffect_ScreenMsg("killing/stage/3");
        b.getAPI().fieldEffect_ScreenMsg("killing/first/start");
        b.getAPI().spawnMobLimit(9830005, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830005, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830006, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830006, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830005, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830005, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830006, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830006, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830005, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830005, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830006, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830007, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830005, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830005, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830007, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830007, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830005, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830005, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830007, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830007, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830008, 1, 634, -27, 100)
    })
}

function mob4(a) {
    a.getPlayers().forEach(function (b) {
        b.getAPI().uiChangeStage(4);
        b.getAPI().setQuestCustomData(9930001, 4);
        b.getAPI().fieldEffect_ScreenMsg("killing/stage/4");
        b.getAPI().fieldEffect_ScreenMsg("killing/first/start");
        b.getAPI().spawnMobLimit(9830009, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830010, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830009, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830010, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830009, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830010, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830009, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830010, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830009, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830010, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830011, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830011, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830011, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830011, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830011, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830011, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830011, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830011, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830012, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830012, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830013, 1, -634, -27, 100)
    })
}

function mob5(a) {
    a.getPlayers().forEach(function (b) {
        b.getAPI().uiChangeStage(5);
        b.getAPI().setQuestCustomData(9930001, 5);
        b.getAPI().fieldEffect_ScreenMsg("killing/stage/5");
        b.getAPI().fieldEffect_ScreenMsg("killing/first/start");
        b.getAPI().spawnMobLimit(9830014, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830015, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830014, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830015, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830014, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830015, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830014, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830015, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830014, 1, -634, 153, 100);
        b.getAPI().spawnMobLimit(9830015, 1, 634, 153, 100);
        b.getAPI().spawnMobLimit(9830016, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830017, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830017, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830016, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830016, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830017, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830016, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830016, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830017, 1, 634, -27, 100);
        b.getAPI().spawnMobLimit(9830017, 1, -634, -27, 100);
        b.getAPI().spawnMobLimit(9830018, 1, 634, 153, 100)
    })
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    if (b.getQuestStatus(16406) == 1) {
        b.getAPI().addNumberForQuestInfo(16406, "count", 1)
    }
    if (b.getQuestStatus(16407) == 1) {
        b.getAPI().addNumberForQuestInfo(16407, "count", 1)
    }
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
}

function onItemPickedUp(b, a, c) {};